<!--#include file="conn.asp"-->
<!--#include file="chkuser.asp"-->
<%
call adminRight(2)

ArticleID=request("ArticleID")
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>编辑信息</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="./../kindeditor/kindeditor.js"></script>
</head>
<body>
<%
   sql="select * from News where id="&ArticleID
   Set rs = Server.CreateObject("ADODB.Recordset")
   rs.open sql,conn,1,1
%>
   <form method="post" name="myform" action="Admin_News_Save.asp?action=Modify" onSubmit="return checkadd()">
    <div id="frame_Toolbar" class="toolbarBg"> 
		<a href="javascript:self.history.back();" class="icoBtn_ct"><span class="btnIco btnBack"></span>返回</a> 
		<a href="javascript:self.location.reload();" class="icoBtn_ct"><span class="btnIco btnReload"></span>刷新</a> 
		<span class="split ftSplit" ></span>
	<div id="guide" class="light_orange">请填写信息！</div>
	<div class="pageInfo right light_gray"></div>
    </div>
    <table class="cTable_2 table">
	<tr class="cTitle toolbarBg">
		<td colspan="2"><div class="cLeftPadding">编辑信息&nbsp;&nbsp;&nbsp;&nbsp;
				<%if NImage_con=True then%>
				<a href="#" onClick="show('ImageManage');return false;" style="color:#FF0000">图片管理</a>
				<%end if%>
				</div>
			<%if NImage_con=True then%>
			<div id="ImageManage" style="display:none;
			filter:alpha(opacity=90);
			opacity:0.9;
			background:#FFFFFF;
			border-top: 1px solid #D7D7D7;
			border-left: 2px solid #D7D7D7;
			border-bottom: 3px solid #D7D7D7;
			border-right: 3px solid #D7D7D7;
			overflow:hidden;
			position:absolute;
			left:180px;
			top:40px;">
				<div style="height: 28px; background: url(images/titlebg.jpg); padding-top: 5px; cursor:move; margin-top: -3px;" id="divImageTitle">
					<div style="text-align: left; float: left; padding-left: 12px;">
						<b title="<%=rs("title")%>"><%=gotTopic(rs("Title"),33)%></b>&nbsp;图片库	
					</div>
					<div style="text-align: right; float: right; padding-right: 12px;">
						<span style="cursor: hand;" onClick="closeed('ImageManage');return false;">
						  关闭
						</span>
					</div>
				</div>
				<div style="margin: 0; width: 600;">
					<iframe ID="News_Image" src="Admin_News_Image.asp?pid=<%=rs("ID")%>" frameborder=0 scrolling=no width="600" height="530"></iframe>
				</div>
			</div>
			<%end if%>					</td>
	</tr>
<%if NewsClassSD_con>0 then%>	
	<tr>
	  <td width="15%" class="tRight">文章类别：</td>
	  <td>
		<%
		arrClassID=array(rs("OneClassID"),rs("TwoClassID"),rs("ThreeClassID"))
		strClassName=""
		for arrClassID_i=0 to ubound(arrClassID)
		if arrClassID(arrClassID_i)=0 then exit for
			set rsc=server.CreateObject("adodb.recordset")
			sqlc="select * from newsclass where id="&arrClassID(arrClassID_i)
			rsc.open sqlc,conn,1,1
			if rsc.eof then exit for
				if strClassName="" then
					strClassName=rsc("classname")
				else
					strClassName=strClassName&" <font color=ff0000>&gt;&gt;</font> "&rsc("classname")
				end if
			rsc.close
			set rsc=nothing
		next
		if strClassName="" then strClassName="请选择类别"
		%> 
		<div id="strClassName" class="left"><%=strClassName%></div> 
		<div class="left">
			<input name="OneClassID" id="OneClassID" type="hidden" value="<%=rs("OneClassID")%>" />
			<input name="TwoClassID" id="TwoClassID" type="hidden" value="<%=rs("TwoClassID")%>" />
			<input name="ThreeClassID" id="ThreeClassID" type="hidden" value="<%=rs("ThreeClassID")%>" />
			<span style="color:Red;">*</span>
			<!--#include file="Admin_NewsClass_Select.asp"-->
			<font color="#FF6600">点击图标选择类别</font>
		</div>
      </td>
	</tr>
<%end if%>	  
	<tr>
		<td width="15%" class="tRight">文章标题：</td>
		<td><input name="Title" type="text" style="width:300px;" value='<%=rs("Title")%>' maxlength="255" />
	    <span style="color:Red;">*</span></td>
	</tr>
	<tr <%if NewsSubtitle_con=False then response.Write("style='display:none'") end if%>>
		<td class="tRight">文章副标题：</td>
		<td><input name="SubTitle" type="text" style="width:300px;" value='<%=rs("SubTitle")%>' maxlength="255" />
	    </td>
	</tr>
	<tr>
		<td class="tRight">发布者：</td>
		<td>
		<input name="publisher" type="text" maxlength="255" style="width:300px;" value="<%=rs("publisher")%>" />
		<span style="color:Red;">*</span></td>
	</tr>
	<tr <%if Newspic_con=False then response.Write("style='display:none'") end if%>>
		<td class="tRight">图片上传：</td>
	    <td>
		<div class="left"><input name="pic" type="text" id="pic" style="width:300px;" maxlength="255" value="<%=rs("pic")%>" /></div>
	    <div class="left"><iframe src="Upload_form_lt.asp?n=pic&x=1" height="25" width="350" frameborder="0"></iframe></div>
	    </td>
	</tr>
	<tr>
	  <td valign="top" class="tRight"></td>
	  <td><div style="width:650px; text-align:right; padding-top:8px"><span style="float:right"><iframe src="Upload_form_lt.asp?n=Content&x=2" height="25" width="320" frameborder="0"></iframe></span><span style="float:right; padding-top:4px">图片或文件快速上传：</span></div></td>
    </tr>
	<tr>
		<td valign="top" class="tRight">文章内容：</td>
		<td>
	    <script type="text/javascript">
		KE.show({
			id : 'Content',
			allowFileManager : true,
			afterCreate : function(id) {
				KE.blur(id);
			}
		});
	    </script>
		<div class="editor">
        <textarea id="Content" name="Content" style="width:650px;height:350px;visibility:hidden;"><%=replace(rs("Content"),"="&chr(34)&"./","="&chr(34)&"./../")%></textarea>
        </div>
		</td>
	</tr>
	<tr>
	  <td class="tRight">首页图片：</td>
	  <td> <input name="DefaultPicUrl" type="text" id="DefaultPicUrl" value="<%=rs("DefaultPicUrl")%>" style="width:300px" maxlength="255" readonly="0"> 
              <br>
              首页的图片,直接从上传图片中选择： 
              <select name="DefaultPicList" id="DefaultPicList" onChange="DefaultPicUrl.value=this.value;">
                <option value="images/nopic.gif" <% if rs("DefaultPicUrl")="images/nopic.gif" then response.write "selected" %>>不指定首页图片</option>
                <%
				if rs("UploadFiles")<>"" then
					dim IsOtherUrl
					IsOtherUrl=True
					if instr(rs("UploadFiles"),"|")>1 then
						dim arrUploadFiles,intTemp
						arrUploadFiles=split(rs("UploadFiles"),"|")						
						for intTemp=0 to ubound(arrUploadFiles)
							if rs("DefaultPicUrl")=arrUploadFiles(intTemp) then
								response.write "<option value='" & arrUploadFiles(intTemp) & "' selected>" & arrUploadFiles(intTemp) & "</option>"
								IsOtherUrl=False
							else
								response.write "<option value='" & arrUploadFiles(intTemp) & "'>" & arrUploadFiles(intTemp) & "</option>"
							end if
						next
					else
						if rs("UploadFiles")=rs("DefaultPicUrl") then
							response.write "<option value='" & rs("UploadFiles") & "' selected>" & rs("UploadFiles") & "</option>"
							IsOtherUrl=False
						else
							response.write "<option value='" & rs("UploadFiles") & "'>" & rs("UploadFiles") & "</option>"		
						end if
					end If
					if IsOtherUrl=True and rs("DefaultPicUrl")<>"images/nopic.gif" then
						response.write "<option value='" & rs("DefaultPicUrl") & "' selected>" & rs("DefaultPicUrl") & "</option>"
					end if
				end if
				 %>
              </select><input name="UploadFiles" type="hidden" id="UploadFiles" value="<%=rs("UploadFiles")%>">           </td>
	  </tr>
	<tr>
	  <td  class="tRight">发布日期：</td>
	  <td><input name="AddDate" type="text" value="<%=rs("AddDate")%>" id="AddDate">
	    若自行修改，请保持原有格式！</td>
	  </tr>
	<tr>
	  <td class="tRight">推荐：</td>
	  <td>
	      <input name="Show" type="checkbox" id="Show" value="True" <%if rs("Show")=True then response.Write("checked") end if%> />
	   	  <input name="ArticleID" type="hidden" id="ArticleID" value="<%=rs("ID")%>">
	   </td>
	  </tr>
    </table>
	<%
	   rs.close
	   set rs=nothing
	%>
    <div id="cEndToolbar" class="toolbarBg">
      <div class="caButCase">
		    <input type="submit" name="Submit" value="确认修改" class="button">
	        <input type="reset" name="Submit2" value="清空重填" class="button">
      </div>
    </div>
  </form>
</body>
</html>
<script language="javascript">
function AddItem(strFileName){
  document.myform.DefaultPicUrl.value=strFileName;
  document.myform.DefaultPicList.options[document.myform.DefaultPicList.length]=new Option(strFileName,strFileName);
  document.myform.DefaultPicList.selectedIndex+=1;
  if(document.myform.UploadFiles.value==''){
	document.myform.UploadFiles.value=strFileName;
  }
  else{
    document.myform.UploadFiles.value=document.myform.UploadFiles.value+"|"+strFileName;
  }
}


function checkadd()
{
<%if NewsClassSD_con>0 then%>	
    if(document.myform.OneClassID.value=="")
		 {  
			alert("请选择信息类别!");  
			return (false);  
		  }
<%end if%>		  
    if(document.myform.Title.value=="")
		 {  
			alert("请填写标题!");  
			document.myform.Title.focus();  
			return (false);  
		  }
   if(document.myform.publisher.value=="")
		 {  
			alert("请填写发布者!");  
			document.myform.publisher.focus();  
			return (false);  
		  } 
	
}
</script>
<%if NImage_con=True then%>
<script type="text/javascript">
 var prox;
 var proy;
 var proxc;
 var proyc;
 function show(id){/*--打开--*/
  clearInterval(prox);
  clearInterval(proy);
  clearInterval(proxc);
  clearInterval(proyc);
  var o = document.getElementById(id);
  o.style.display = "block";
  o.style.width = "1px";
  o.style.height = "5px"; 
  prox = setInterval(function(){openx(o,600)},10);
 } 
 function openx(o,x){/*--打开x--*/
  var cx = parseInt(o.style.width);
  if(cx < x)
  {
   o.style.width = (cx + Math.ceil((x-cx)/5)) +"px";
  }
  else
  {
   clearInterval(prox);
   proy = setInterval(function(){openy(o,552)},10);
  }
 } 
 function openy(o,y){/*--打开y--*/ 
  var cy = parseInt(o.style.height);
  if(cy < y)
  {
   o.style.height = (cy + Math.ceil((y-cy)/5)) +"px";
  }
  else
  {
   clearInterval(proy);   
  }
 } 
 function closeed(id){/*--关闭--*/
  clearInterval(prox);
  clearInterval(proy);
  clearInterval(proxc);
  clearInterval(proyc);  
  var o = document.getElementById(id);
  if(o.style.display == "block")
  {
   proyc = setInterval(function(){closey(o)},10);   
  }  
 } 
 function closey(o){/*--关闭y--*/ 
  var cy = parseInt(o.style.height);
  if(cy > 5)
  {
   o.style.height = (cy - Math.ceil(cy/5)) +"px";
  }
  else
  {
   clearInterval(proyc);    
   proxc = setInterval(function(){closex(o)},10);
  }
 } 
 function closex(o){/*--关闭x--*/
  var cx = parseInt(o.style.width);
  if(cx > 0)
  {
   o.style.width = (cx - Math.ceil(cx/5)) +"px";
  }
  else
  {
   clearInterval(proxc);
   o.style.display = "none";
  }
 } 
 
 
 /*-------------------------鼠标拖动---------------------*/ 
 var od = document.getElementById("divImageTitle");
 var odContent = document.getElementById("ImageManage"); 
 var dx,dy,mx,my,mouseD;
 var odrag;
 var isIE = document.all ? true : false;
 document.onmousedown = function(e){
  var e = e ? e : event;
  if(e.button == (document.all ? 1 : 0))
  {
   mouseD = true;   
  }
 }
 document.onmouseup = function(){
  mouseD = false;
  odrag = "";
  if(isIE)
  {
   od.releaseCapture();
   //od.filters.alpha.opacity = 100;
  }
  else
  {
   window.releaseEvents(od.MOUSEMOVE);
   od.style.opacity = 1;
  }  
 }
 
 
 //function readyMove(e){ 
 od.onmousedown = function(e){
  odrag = this;
  var e = e ? e : event;
  if(e.button == (document.all ? 1 : 0))
  {
   mx = e.clientX;
   my = e.clientY;
   od.style.left = od.offsetLeft + "px";
   od.style.top = od.offsetTop + "px";
   if(isIE)
   {
    od.setCapture();    
    //od.filters.alpha.opacity = 50;
   }
   else
   {
    window.captureEvents(Event.MOUSEMOVE);
    od.style.opacity = 0.5;
   }
   
   //alert(mx);
   //alert(my);
   
  } 
 }
 document.onmousemove = function(e){
  var e = e ? e : event;
  
  //alert(mrx);
  //alert(e.button);  
  if(mouseD==true && odrag)
  {  
   var mrx = e.clientX - mx;
   var mry = e.clientY - my; 
   od.style.left = parseInt(od.style.left) +mrx + "px";
   od.style.top = parseInt(od.style.top) + mry + "px";   
   odContent.style.left = parseInt(odContent.style.left) +mrx + "px";
   odContent.style.top = parseInt(odContent.style.top) + mry + "px";   
   mx = e.clientX;
   my = e.clientY;
   
  }
 }
</script>
<%end if%>